      <div class="templatemo-content-wrapper">
        <div class="templatemo-content">
        	<ul class="nav nav-tabs mytabs">
		  	 <li  class="active"><a href="<?=site_url()?>/category/index">分类列表</a></li>
		  	 <li><a href="<?=site_url()?>/category/add">添加分类</a></li>
		  </ul>
          <div class="row">
            <div class="col-md-12">
              <div class="table-responsive">
                <table class="table table-striped table-hover table-bordered">
                  <thead>
                    <tr>
                      <th>ID</th>
                      <th>名称</th>
                      <th>描述</th>
                      <th>操作</th>
                    </tr>
                  </thead>
                  <tbody>
                  	<?php foreach ($categories as $item):?>
                    <tr>
                      <td><?php echo $item['id'];?></td>
                      <td><?php echo $item['name'];?></td>
                      <td><?php echo $item['description'];?></td>
                      <td>
                      	   <a href="<?php echo site_url('category/edit/id/'.$item['id'])?>" class="">编辑</a>                    
                      	   |<a href="#" class="del" data-id="<?php echo $item['id'];?>" >删除</a>
                      </td>
                    </tr>
                     <?php endforeach;?>
                  </tbody>
                </table>
              </div>
            </div>
          </div>
        </div>
      </div>
    <script>
	$(document).ready(function() {
		$(".del").click(function() {
			if(confirm("确定要删除该分类吗？"))
			{
			var id = $(this).attr("data-id");
			$.ajax({
				url : '<?php echo site_url('category/delete')?>',
				type : "post",
				async : true,
				data : {
					'id' : id
				},
				dataType : "json",
				success : function(data) {
					if(data.code)
					{
						alert(data.msg);
						window.location.reload();
					}else{
						alert(data.msg);
					}
				}
			});
			}
		});
	}); 
</script>